feat(client): add typed DynamoClient with DI and integration tests#90
Draft
feat(client): add typed DynamoClient with DI and integration tests#90
Conversation
- Added `LayeredCraft.DynamoMapper.Client` project with initial setup. - Defined `IDynamoMapper` interface for mapping DTOs to/from DynamoDB items. - Integrated `AWSSDK.DynamoDBv2` package as a dependency. - Updated solution file to include the new project.
- Removed redundant configurations and entries in `.DotSettings`. - Improved formatting and alignment for settings keys. - Simplified the file structure by reducing unnecessary verbosity.
- Added `DynamoClient` to interact with DynamoDB using registered mappers. - Introduced `DynamoClientBuilder` for flexible client configuration. - Updated `IDynamoMapper` interface to remove static methods and simplify implementation.
- Renamed `LayeredCraft.DynamoClient` namespace to `LayeredCraft.DynamoMapper.Client`. - Updated references in `IDynamoMapper`, `DynamoClient`, and `DynamoClientBuilder`.
…moDB client - Updated `_dynamoDbClient` private field to `AmazonDynamoDb` public property. - Replaced references to `_dynamoDbClient` with `AmazonDynamoDb` in methods.
- Changed `GetItemAsync` to return `Task<T?>` and use `await` for asynchronous processing. - Improved null check logic by verifying `result.Item.Count` instead of relying on `Result`.
…Client and its builder - Added XML documentation for all public methods and properties. - Introduced convenience methods in `DynamoClient`: `PutItemAsync`, `DeleteItemAsync`, `UpdateItemAsync`, `QueryAsync`, and `ScanAsync`. - Enhanced `DynamoClientBuilder` with descriptive summaries for method functionality.
- Disabled `MemberCanBePrivate.Global` inspection in `DynamoClient.cs` to improve readability.
- Added `LayeredCraft.DynamoMapper.Client.Tests` project with initial setup. - Included `AWSSDK.DynamoDBv2` and `xUnit` packages as dependencies. - Updated solution file to reference the new test project. - Configured `xunit.runner.json` for test execution. - Added project references for required dependencies in the test project.
- Created `.claude/skills/dynamo-mapper` directory to enable skill integration. - Introduced initial setup for DynamoMapper skill in the project.
- Added `.agents/skills/git-workflow` directory with documentation, examples, templates, and shared logic. - Introduced workflows for branching, committing, and pull requests, adhering to conventional commits. - Defined `Skill` metadata in `SKILL.md` for intent-specific routing and execution. - Included safety rules, scope detection, and file inclusion policy for robust and transparent handling. - Configured templates for pull requests, release notes, and validation reporting. - Created initial examples for feature, fix, and CI scenarios.
…odels - Added mappers (`UserProfileMapper`, `ProjectRecordMapper`, `TaskRecordMapper`) for testing DynamoMapper. - Introduced data models (`UserProfile`, `ProjectRecord`, `TaskRecord`, etc.) for testing purposes. - Set up `DynamoDbFixture` using `Testcontainers.DynamoDb` for integration tests. - Updated test project dependencies, including `Testcontainers.DynamoDb`. - Configured `LayeredCraft.DynamoMapper.Client.Tests.csproj` for analyzer and runtime references.
- Updated documentation to clarify mapper classes can be instance-based or static. - Adjusted examples to include non-static mapper declarations and methods. - Added guidance to avoid assumptions that mappers or methods must be static.
…tests - Introduced `TestDataSamples` for sample user profiles, project records, and task records. - Populated data models to improve test coverage and simulation realism. - Enhanced `DynamoDbFixture` with table creation for integration tests. - Added batch item writer to preload sample data in `DynamoDbFixture`.
- Introduced tests for `GetItemAsync`, `QueryAsync`, `ScanAsync`, `PutItemAsync`, `DeleteItemAsync`, and `UpdateItemAsync` methods. - Verified CRUD operations and query behaviors using seeded test data. - Enhanced test coverage for mapper handling and integration setup. - Refined null check logic in `GetItemAsync` to handle edge cases efficiently.
- Introduced `DynamoClientServiceBuilder` for configuring `DynamoClient` in DI containers. - Added `DynamoClientServiceCollectionExtensions` to simplify `DynamoClient` registration. - Enabled mapper registration via `AddMapper` and Amazon DynamoDB client injection. - Updated `DynamoClientBuilder` to support instance-based mappers via type registration. - Enhanced tests to verify `AddDynamoClient` functionality and client resolution from DI. - Updated project dependencies to include `Microsoft.Extensions.DependencyInjection`.
…pport - Added `GetItemResponse<T>` model to encapsulate `GetItem` results with mapped DTO support. - Extended `DynamoClient` with `ExecuteStatementAsync` methods for PartiQL query execution. - Updated `GetItemAsync` to return `GetItemResponse<T>` for enriched result handling. - Added integration tests for new methods including typed and raw PartiQL responses. - Enhanced existing tests to validate `MappedItem` usage in response processing.
…ryResponse model - Updated `PutItemAsync` and `DeleteItemAsync` to return detailed responses: `PutItemResponse` and `DeleteItemResponse`. - Enhanced `UpdateItemAsync` to return `UpdateItemResponse` for consistency with other methods. - Modified `QueryAsync` to return the new `QueryResponse<T>` model, providing enriched result handling. - Added `QueryResponse<T>` class to encapsulate raw query response details and mapped DTO items. - Improved type safety and clarity in DynamoDB result processing.
…StatementResponse models - Introduced `ScanResponse<T>` and `ExecuteStatementResponse<T>` models for enriched result handling. - Updated `DynamoClient` methods to use the new models, improving type safety and clarity. - Enhanced `UpdateItemAsync` to return mapped DTOs when attributes are present. - Updated tests to validate usage of `MappedItems` and new response models across multiple scenarios.
…nsions and update usage - Added `AttributeValueConverterExtensions` with methods for converting common types to `AttributeValue`. - Refactored `DynamoClientTests` to use the new extension methods for cleaner attribute creation. - Improved test readability and reliability by replacing inline `AttributeValue` creation with extensions. - Verified compatibility with existing tests to ensure no regressions.
- Replaced inline assertions (`.Should().Be` and `.NotBeTrue`) with `BeEquivalentTo` for consistency. - Refactored tests to use helper methods for creating `AttributeValue` objects (e.g., `StringAttribute`, `NumberAttribute`). - Removed `AssertNullAttribute` in favor of `BeEquivalentTo(NullAttribute())`. - Improved test readability and alignment with FluentAssertions best practices.
…moClient - Removed `ExecuteStatementAsync` method that returned raw DynamoDB responses. - Kept the typed `ExecuteStatementAsync<T>` method for mapped DTO handling. - Simplified the `DynamoClient` interface by eliminating unused raw response handling.
…h mapped attributes - Introduced `DeleteItemResponse<T>`, `PutItemResponse<T>`, and `UpdateItemResponse<T>` models. - Enhanced `DynamoClient` methods (`PutItemAsync`, `DeleteItemAsync`, `UpdateItemAsync`) to return enriched responses. - Updated integration tests to validate new response handling and mapped attributes (`MappedItem`). - Refactored test scenarios for CRUD operations to improve coverage and validation consistency.
- Introduced `.opencode/opencode.jsonc` for defining code formatting instructions and tools. - Configured `cs-jb-formatter` for formatting `.cs`, `.props`, and `.csproj` files using JetBrains cleanup tool. - Configured `mdformat` for `.md` files with MkDocs and frontmatter support. - Added file exclusions for `.agents`, `.claude`, and `.opencode` directories.
- Added `.claude/hooks/format.py` for handling C# and Markdown file formatting. - Configured `format.py` to use JetBrains cleanup tool for C# and `mdformat` for Markdown. - Integrated format hook into `.claude/settings.json` to trigger after tool usage. - Supported exclusions for `.agents`, `.claude`, and `.opencode` directories.
…path - Updated `format.py` to retrieve `DOTSETTINGS_FILE` via environment variable for better configurability. - Added `env.DOTSETTINGS_FILE` entry in `.claude/settings.json` for default file path configuration.
beff52d to
4153f8b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new
LayeredCraft.DynamoMapper.Clientpackage that wrapsIAmazonDynamoDBwith typed read/write helpers backed by registeredIDynamoMapper<TDto>implementations. It also adds dependency injection registration so applications can compose a singletonDynamoClientfrom mapper registrations, and introduces integration tests against DynamoDB Local to verify the client works end to end with generated mappers. The branch also includes repository-local agent skill updates that were developed alongside the client work.Changes
LayeredCraft.DynamoMapper.Clientproject withIDynamoMapper<TDto>,DynamoClient, andDynamoClientBuilderfor typed DynamoDB access.AddDynamoClient(...)andDynamoClientServiceBuilder, including mapper registration and optionalIAmazonDynamoDBoverride support.LayeredCraft.DynamoMapper.Client.Testsproject with DynamoDB Local integration coverage forGetItemAsync,PutItemAsync,DeleteItemAsync,UpdateItemAsync,QueryAsync,ScanAsync, and DI-based resolution.dynamo-mapperskill and the addition of thegit-workflowskill assets used in this repo.Validation
dotnet test --project test/LayeredCraft.DynamoMapper.Client.Tests/LayeredCraft.DynamoMapper.Client.Tests.csprojRelease Notes
LayeredCraft.DynamoMapper.Clientpackage that provides mapper-driven typed DynamoDB access plus dependency injection registration helpers.Notes for Reviewers
src/LayeredCraft.DynamoMapper.Client/*andtest/LayeredCraft.DynamoMapper.Client.Tests/*..agents/skills/*,.claude/skills/*, andskills/*changes are repository-local automation/documentation updates and can be reviewed separately from the runtime client behavior.